package com.travel.model.entity.service;

import com.travel.model.enums.BookingStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "bookings")
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "预订实体")
public class Booking {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Schema(description = "预订ID")
    private Long id;

    @Column(name = "user_id")
    @Schema(description = "预订用户")
    private Long userId;

    @Column(name = "service_id")
    @Schema(description = "预订服务")
    private Long serviceId;

    @Column(name = "booking_date")
    @Schema(description = "预订日期")
    private LocalDateTime bookingDate;

    @Schema(description = "预订状态")
    @Enumerated(EnumType.STRING)
    private BookingStatus status;

    @Schema(description = "预订金额")
    private BigDecimal amount;

    @CreatedDate
    @Schema(description = "创建时间")
    @Column(name = "created_time")
    private LocalDateTime createdTime;

    @LastModifiedDate
    @Schema(description = "更新时间")
    @Column(name = "updated_time")
    private LocalDateTime updatedTime;
} 